void main() {
  List<int> array = [];
  // 数组为空，取第一个元素会抛出异常
  // int first = array?.first;
  // print(first);

  // 数组为空，indexWhere返回-1
  int index = array?.indexWhere((element) => element == 1);
  print(index);

  // 数组为null，indexWhere返回null
  array = null;
  index = array?.indexWhere((element) => element == 1);
  print(index);
}
